import { createRouter, createWebHashHistory } from 'vue-router'
import {useAuthStore} from "@/stores/auth.js";
import login_routes from "@/router/login";
import frame_routes from "@/router/frame";
const router = createRouter({
  history: createWebHashHistory(import.meta.env.BASE_URL),
  routes: frame_routes.concat(login_routes),
})
router.beforeEach((to, from) => {
  const authStore = useAuthStore()
  if(!authStore.is_logined && to.name != 'login'){
    return {name: 'login'}
  }
})

export default router
